package homework;

import java.util.ArrayList;

public class work2 {
    public static void main(String[] args) {
        ArrayList ay = new ArrayList<>();
        ay.add(new Car("baoma", 400000));
        ay.add(new Car("binli", 50000000));
        System.out.println(ay);
    }
}
class Car{
    private String name;
    private int price;
    public Car(String name,int price){
        this.name=name;
        this.price = price;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void setPrice(int price) {
        this.price = price;
    }public String getName() {
        return name;
    }
    public int getPrice() {
        return price;
    }
    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return "card的name"+name+"价值"+price;
    }
}
